﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UwinEducation.Shared.Enums;

namespace UwinEducation.Domain.Entities
{
    /// <summary>
    /// 学生课表明细实体
    /// </summary>
    [Table("student_schedules_details")]
    public class StudentScheduleDetails : EntityBase
    {
        /// <summary>
        /// 学生课表详情ID
        /// </summary>
        public Guid Id { get; set; }

        /// <summary>
        /// 学生课表ID/订单详情ID
        /// </summary>
        public Guid OrderDetailId { get; set; }

        /// <summary>
        /// 教师课表详情ID
        /// </summary>
        public Guid TeacherScheduleDetailsId { get; set; }
        /// 课表状态
        /// </summary>
        public ScheduleStatus Status { get; set; }

        /// <summary>
        /// 废弃原因
        /// </summary>
        public string? Reason { get; set; }

        /// <summary>
        /// 是否强校验
        /// </summary>
        public bool IsForceCheck { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string? Remarks { get; set; }
        /// <summary>
        /// 学生上课类型
        /// </summary>    
        public CourseType CourseType { get; set; }

        public virtual OrderDetail OrderDetail { get; set; }

        public virtual TeacherScheduleDetails TeacherScheduleDetails { get; set; }


        /// <summary>
        /// 创建学生课表详情
        /// </summary>
        /// <summary>
        /// 创建学生课表记录
        /// </summary>
        public static StudentScheduleDetails Create(
            Guid orderDetailId,
            Guid teacherScheduleDetailsId,
            bool isForceCheck,
            CourseType courseType,
            string? reason,
            string? remarks = null
        )
        {
            return new StudentScheduleDetails
            {
                Id = Guid.NewGuid(),
                OrderDetailId =orderDetailId,
                TeacherScheduleDetailsId = teacherScheduleDetailsId,
                Status = ScheduleStatus.Normal,
                IsForceCheck = isForceCheck,
                CourseType = courseType,
                Reason = reason,
                Remarks = remarks,
                CreatedAt = DateTime.Now,
            };
        }
    }
}
